home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
6_17.lha
/
6_17
/
6_17a5.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
394b
|
23 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ x = 5.0
ector& vector::operator=(float x)
int l = p->length;
if (p->refcnt > 1)
{
p->refcnt--;
p = new vrep;
p->length = l;
p->refcnt = 1;
p->f = new float[l];
}
float *f = p->f;
for (int i = 0; i < l; i++)
*f++ = x;
return *this;